package com.wuxiaoqin.server.mapper;

import com.wuxiaoqin.server.entity.Users;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-10-22
 */
public interface UsersMapper extends BaseMapper<Users> {

    @Select("select * from users where U_name=#{uName}")
    Users getAcct(String uName);

    @Select("select * from users where U_id=#{id}")
    Users selectid(int id);

    //注册
    @Insert("insert into users(U_name,U_mail,U_phone,U_pswd,privatekey,U_createTime) values(#{name},#{email},#{phone},#{password},#{privatekey},#{date})")
    void insertUser(String name, String email,  String phone,String password,String privatekey,String date);

    //修改密码
    @Update("update users set U_pswd=#{password},privatekey=#{privatekey} where U_phone=#{phone}")
    void passmod(String phone,String password,String privatekey);

    //修改用户信息
    @Update("update users set U_name=#{name},U_sex=#{sex},U_mail=#{email},U_signature=#{signature} where U_id=#{id}")
    void userInfoModify(Integer id, String name, Integer sex, String email, String signature);
}
